/*
 * Copyright (C) 2018 wxyz <hyhjwzx@126.com>
 * This program can be distributed under the terms of the GNU GPL Version 2.
 * See the file LICENSE.
 *
 */

package ren.wxyz.study.euler.hp01;

import ren.wxyz.study.euler.base.IProblem;
import ren.wxyz.study.euler.util.ConsoleHelper;
import ren.wxyz.study.euler.util.MathHelper;

/**
 * 第 7 题
 *
 * @auther wxyz 2018-03-08_20:04
 * @since 1.0
 */
public class P007 implements IProblem {

    @Override
    public void main(String[] args) throws Throwable {
        int limitNumber = Integer.parseInt(args[0]);

        int tmp = 0;
        int prime = 1;
        while (tmp < limitNumber) {
            prime++;

            if (MathHelper.isPrimeNumber(prime)) {
                tmp++;
            }
        }

        ConsoleHelper.printf("第 %1$d 个素数是 %2$d", limitNumber, prime);
        ConsoleHelper.print();
    }
}
